export default {
    namespaced: true,
     state: {
        userInfo: null, // 用户信息
        isLoggedIn: false, // 是否已登录
    },
    mutations: {
        setUserInfo(state, payload) {
            state.userInfo = payload; // 更新用户信息
        },
        setIsLoggedIn(state, status) {
            state.isLoggedIn = status; // 更新登录状态
        },
    },
    actions: {
        login({ commit }, user) {
            // 模拟登录逻辑
            commit('setUserInfo', user);
            commit('setIsLoggedIn', true);
        },
        logout({ commit }) {
            // 模拟登出逻辑
            commit('setUserInfo', null);
            commit('setIsLoggedIn', false);
        },
    },
    getters: {
        isAuthenticated:(state)=> state.isLoggedIn,
        getUserInfo:(state)=>state.userInfo

    },
};